#!/usr/bin/python
# -*- coding: UTF-8 -*-

class Student(object):
    """
    学生类
    """
    pass
    def __init__(self,name,age):
        '''
        构造方法
        :param name:
        :param age:
        '''
        self.__name=name
        self.age=age

    def __str__(self):
        '''
        相当于toString方法
        :return:
        '''
        return "name:%s,age:%d."%(self.__name,self.age)

    @property
    def name(self):
        return self.__name

    @name.setter
    def name(self,value):
        if not type(value)=='str':
            raise ValueError("名称必须是一个字符串")

if __name__ == '__main__':
    str=Student("张三",18)
    str.name=44

    print str